
<meta charset="utf-8">
<div class="box" id="biz_pmpProject_group_conatainer" style="height: 500px">
	<div class="box-header with-border" >
	<p><stong>项目名：</stong>{{pmpProject.name}}<br><stong>创建时间</stong>： {{pmpProject.createtime}}</p>
	</div>
	<div class="box-body">
				<div class="btn-group " id="pmpProjectTableToolbar" role="group">
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="doSelectDev">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加开发人员
					</button>
					
					<button type="button" v-kperms="{perm:''}" class="btn btn-default" v-on:click="doSelectTester">
						<i class="glyphicon glyphicon-plus" aria-hidden="true"></i> 添加测试人员
					</button>
					
				
				</div>
			<table class="table table-condensed" >
                <tr>
                  <th style="width: 10px">#</th>
                  <th>名字</th>
                  <th>项目组角色</th>
                  <th style="width: 40px">操作</th>
                </tr>
                
                
                 <tr>
                  <td>#.</td>
                  <td>{{pmUser.userName}}</td>
                  <td>项目负责人</td>
                  <td><span class="badge bg-red" v-on:click="doRemove(pmUser.id,'3')">移除</span></td>
                </tr>
                
                
                  <tr v-for="dev in devUserList">
	                  <td>-.</td>
	                  <td>{{dev.userName}}</td>
	                  <td>开发人员</td>
	                  <td><span class="badge bg-red" v-on:click="doRemove(dev.id,'1')">移除</span></td>
				  </tr>
               
             
                  <tr v-for="tester in testUserList">
	                  <td>-.</td>
	                  <td>{{tester.userName}}</td>
	                  <td>测试人员</td>
	                  <td><span class="badge bg-red" v-on:click="doRemove(tester.id,'2')">移除</span></td>
				  </tr>
              </table>
	</div>
</div>
<script>

    
new Vue({  
	  el: '#biz_pmpProject_group_conatainer',
	  data:{
		  pmpProject: {},
		  devUserList:[],
		  testUserList:[],
		  pmUser: {},
		  bus:new Vue(),
	  },
	  mounted:function(){
		  var _this=this;
		_this.init();
	  },
    methods: {
  	  init: function(){
  		var _this=this;
  		_this.$data.pmpProject.name="sadsad";
  		
  		var projectId=zfesLayerEditDg.getLayerParam().projectId;
  		 var ajaxUrl = "/pmp/service/pub/pmpProject/loadProjectGroupDetail";
			zfesAjax.ajaxTodo(ajaxUrl, { "projectId" : projectId}, function(data) {
				_this.$data.pmpProject=data.data.projectGroupDetail.pmpProject;
				_this.$data.devUserList=data.data.projectGroupDetail.devUserList;
				_this.$data.testUserList=data.data.projectGroupDetail.testUserList;
				_this.$data.pmUser=data.data.projectGroupDetail.pmUser;
			}); 
  	  },
  	  doRemove: function(userId,userType){
  		  var _this=this;
  		var url="/pmp/service/ma/pmpProject/deleteOneProjectGroupMember";
			zfesAjax.ajaxTodo(url, { "projectId" : _this.$data.pmpProject.id, "userId" :userId,"userType": userType}, function(data) {
				alertSwal.successText(data.message);
				_this.init();
			}); 
		},
	    doSelectDev:  function(){
	    	 var _this=this;
 			  var url="/views/cloudMember/cloudMember.lookback.html";
 			  zfesLayerEditDg.lookback(url,{},"人员列表",600,function(){
 				  var rows=zfesLayerEditDg.getCallBackParam();
 				  if(rows&&rows.length>0){
 					rows.forEach(function(item,index){
 						var urlx="/pmp/service/ma/pmpProject/addOneProjectGroupMember";
 						var param={"projectId":_this.$data.pmpProject.id,"userId":item.id,"userType":1};
 						zfesAjax.ajaxTodo(urlx, param, function(data) {
 							_this.init();
							}); 
 					});
 				  }
 			  }); 
	    },
	    doSelectTester:  function(){
	    	 var _this=this;
			  var url="/views/cloudMember/cloudMember.lookback.html";
			  zfesLayerEditDg.lookback(url,{},"人员列表",600,function(){
				  var rows=zfesLayerEditDg.getCallBackParam();
				  if(rows&&rows.length>0){
					  var mids="";
					  var mnames="";
					rows.forEach(function(item,index){
						var urlx="/pmp/service/ma/pmpProject/addOneProjectGroupMember";
 						var param={"projectId":_this.$data.pmpProject.id,"userId":item.id,"userType":2};
 						zfesAjax.ajaxTodo(urlx,param, function(data) {
 							_this.init();
							}); 
					});
				  }
				  
			  }); 
	    }
   }

});
</script>


